
package com.csun.cmny.provider.device.watch.entity;



    /// <summary>
    ///  下行按键告警确认数据包
    ///  关联 上行006
    ///  Downlink button alarm confirmation packet
    ///  Association  command  FunCode: 006
    /// </summary>
    public class C007
    {
        /// <summary>
        /// 数据起封包 @B#@ 
        /// Start Fixed value :@B#@ 
        /// </summary>
        public String HeadCode = "@B#@";
        /// <summary>
        /// 协议版本号
        /// Protocol version number
        /// </summary>
        public String Protocol =null;
        /// <summary>
        /// 功能代码识别
        /// Function code
        /// </summary>
        public final String FunCode = "007";
        /// <summary>
        /// 国际移动设备身份码
        /// International Mobile Equipment Identity
        /// </summary>
        public String IMEI  =null;
        /// <summary>
        /// 数据状态 0：结束 1：继续接受
        /// Terminal wear state  (0: is not worn; 1: is worn)
        /// </summary>
        public int DataState =0;
        /// <summary>
        /// 地址 Unicode 编码(Unicode-UTF8)
        /// Terminal address Unicode-UTF8)
        /// </summary> 
        public String AddressUnicode  =null;
        /// <summary>
        /// 终端佩戴者姓名(Unicode-UTF8)
        /// Terminal wearer's name (Unicode-UTF8)
        /// </summary>
        public String Name  =null;

        /// <summary>
        /// 终端当前时间(年月日时分秒) yyyyMMddHHmmss
        /// The terminal current time ( format:yyyyMMddHHmmss)
        /// </summary>
        public String TerminalTime  =null;
        /// <summary>
        /// 结尾封包 @E#@
        /// End packet @E#@
        /// </summary>
        public String FootCode = "@E#@";


        public C007(){}
        /// <summary>
        /// 初始化模型
        /// @B#@|01|007|111112222233333|0
        /// |\u5317\u4eac\u5e02\u6d77\u6dc0\u533a\u4e2d\u5173\u6751\u5927\u8857\u0032\u0037\u53f7\u0031\u0031\u0030\u0031\u002d\u0030\u0038\u5ba4
        /// |张三|20160805172500|@E#@
        /// </summary>
        /// <param name="cmdStr">命令代码</param>
        public C007(String cmdStr)
        {
            String[] data = cmdStr.split("\\|");
            int dataLength = data.length;
            if (dataLength == 9 && "@B#@".equals(data[0]) && FunCode.equals(data[2]))
            {
                HeadCode = data[0];
                Protocol = data[1];
                IMEI = data[3];
                DataState = Integer.parseInt(data[4]);
                AddressUnicode = data[5];
                Name = data[6];
                TerminalTime = data[7];
                FootCode = data[8];
            }

        }


        public  String ToString()
        {
        	String rString = HeadCode + "|";
            rString += Protocol + "|";
            rString += FunCode + "|";
            rString += IMEI + "|";
            rString += DataState + "|";
            rString += AddressUnicode + "|";
            rString += Name + "|";
            rString += TerminalTime + "|";
            rString += FootCode;
            return rString;
        }
    }




